<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    #app {
      width: 375px;
      height: 667px;
      border: 1px solid #000;
      display: flex;
      flex-direction: column;
    }

    header {
      width: 100%;
      height: 45px;
      border-bottom: 1px solid #000;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .item {
      width: 345px;
      height: 100px;
      border: 1px solid #000;
      margin: 15px;
    }
  </style>
</head>
<body>
  <div id="app">
    <!-- 
      父传子的时候，是通过标签的自定义属性进行传参
      在定义组件的地方，用props选项进行接受
    -->
    <wb-header title="猫眼首页"></wb-header>
    <wb-header title="朗朗人生"></wb-header>

    <wb-item title="美军两架飞机在南海坠毁后" content="中新网10月28日电 据美国福克斯新闻网报道"></wb-item>
    <wb-item title="特朗普谈2028大选" content="距离2028年美国总统大选尚有数年，美国政坛的“特朗普变量”已提前搅动风云。"></wb-item>
  </div>

  <script src="../Vue.js"></script>

  <script>
    const { createApp } = Vue;

    const WbHeader = {
      props: ["title"],
      template: `
        <header>{{title}}</header>
      `
    };

    const WbItem = {
      props: ["title", "content"],
      template: `
        <div class="item">
          <h3>{{title}}</h3>
          <p>{{content}}</p>
          <button>👍</button>
        </div>
      `
    }

    createApp({
      data() {
        return {}
      },
      components: {
        WbHeader,
        WbItem
      }
    }).mount("#app")


    // function fn(n) {

    // }
    // fn(666)
  </script>
</body>
</html>